<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JavaScript 使用误区-赋值运算符应用错误-3</title>
</head>

<!-- if 条件语句返回 false (不是我们预期的)因为条件语句执行为 x 赋值 0，0 为 false -->

<body>
    <p id="demo"></p>
    <script>
        var x = 0;
        document.getElementById("demo").innerHTML = Boolean(x = 0);
    </script>
</body>

</html>